package connect

import (
	"github.com/gorilla/websocket"
	"go-chat-room/util"
)

type User struct {
	UserId    string
	UserName  string
	broadcast chan []byte
	conn      *websocket.Conn
}

func NewUser(conn *websocket.Conn, broadcast chan []byte) *User {
	return &User{
		UserId:    util.UniqueId(),
		UserName:  "",
		broadcast: broadcast,
		conn:      conn,
	}
}

func (user *User) Push(message []byte) {
	user.broadcast <- message
	return
}
